		var backdropLayerTpl = '<div class="modal_backdrop fade"></div>';
		var htmlLayerTpl = [
					'<div class="modala">',
			            '<div class="modal_dialog">',
			                '<div class="modal_content pie_about">',
			                    '<div class="modal_header">',
									'<span class="title J_modal_title"></span>',
			                        '<span class="max_remind J_modal_max"></span>',
			                        '<a href="javascript:;" class="close J_dismiss_modal"></a>',
								'</div>',
			                    '<div class="modal_body">',
			                    	'<div class="listed_group" id="J_listed_group">',
			                    		'<div class="left_text">已选择：</div>',
			                    		'<div class="center_text" id="J_listed_content"></div>',
			                    		'<a href="javascript:;" class="right_text" id="J_listed_clear">清空</a>',
			                    		'<div class="clear"></div>',
			                    	'</div>',
			                    	'<div class="J_modal_content"></div>',
			                    '</div>',
			                    '<div class="modal_footer">',
			                        '<div class="res_add_but">',
			                        	'<div class="butlist">',
			                            	'<div class="btn_blue J_hoverbut btn_100_38 J_btnyes">确 定</div>',
			                            '</div>',
			                            '<div class="butlist">',
			                            	'<div class="btn_lightgray J_hoverbut btn_100_38 J_dismiss_modal J_btncancel">取 消</div>',
			                            '</div>',
			                            '<div class="clear"></div>',
			                        '</div>',
			                    '</div>',
			                    '<input type="hidden" class="J_btnload" />',
			                '</div>',
			            '</div>',
			        '</div>'
				].join('');
		function prepareModal(titleValue, multipleValue, maxNumValue) {
			var ie = !-[1,];
			var ie6 = !-[1,]&&!window.XMLHttpRequest;
			$(backdropLayerTpl).appendTo($(document.body));
			if (ie6) {
				$('.modal_backdrop').css("height", $(document).height());
			}
			$(htmlLayerTpl).appendTo($(document.body));

			$('.J_modal_title').text(titleValue);
			if (multipleValue) {
		    	$('.J_modal_max').text('（最多选择'+ maxNumValue +'个）');
		    };
		    if (!multipleValue) {
		    	$('.modal_footer').hide();
		    };

			$(".J_hoverbut").hover(
				function() {
					$(this).addClass("hover");
				},
				function() {
					$(this).removeClass("hover");
				}
			);

			// 可拖动
			var newObj = $('.modal_dialog');
			var newTit = newObj.find(".modal_header");

			newTit.mousedown(function(e) {
				var offset = newObj.offset();
				var x = e.pageX - offset.left;
	            var y = e.pageY - offset.top;
	            $(document).bind('mousemove', function(ev) {
	            	newObj.bind('selectstart', function() {
	                    return false;
	                });
	                var newx = ev.pageX - x;
	                var newy = ev.pageY - y;
	                newObj.css({
	                    'left': newx + "px",
	                    'top': newy + "px"
	                });
	            });
			});

			$(document).mouseup(function() {
	            $(this).unbind("mousemove");
	        })

			if (ie) {
				if (window.PIE) { 
		            $('.pie_about').each(function() {
		                PIE.attach(this);
		            });
		        }
			};
		}

		$('.J_dismiss_modal').on('click', function() {
	        removeModal();
	    });

	    $(document).on('keydown', function(event) {
	 		if (event.keyCode == 27) {
				removeModal();
			}
	 	});

		function removeModal() {
			setTimeout(function() { 
		    	$('.modal_backdrop').remove();
	 			$('.modala').remove();
			},50)
		}							